﻿using AutoMapper;
using Ducu.BLL.Entity;
using Ducu.SRV.ServiceInteface;
using Ducu.SRV.ViewModel.Profile;
using System;
using Entity = Ducu.BLL.Entity;

namespace Ducu.SRV.ProdService
{
    public class ProfileService : BaseService, IProfileService
    {
        public void Save(EditModel model)
        {
            getCurrentUser().Profile = Mapper.Map<Entity.Profile>(model);
        }

        public EditModel Get()
        {
            return Mapper.Map<EditModel>(getCurrentUser().Profile);
        }

        public EditModel Get(int userId)
        {
            return Mapper.Map<EditModel>(repoFactory.Load<User>(userId).Profile);
        }
    }
}
